Currently, a video file is usually generated by using a video encapsulation technology to encapsulate video data in a video container, where the video container refers to a file format during video data encapsulation, such as the audio video interleaved (AVI) format and the Moving Picture Experts Group (MPEG)-4 Part 14 (MP4) format. FIG. 1 is a schematic structural diagram of a video file, which includes three parts: container header data, container tail data, and video data. The video data consists of data of several video frames, where a video frame refers to one of many still images that form a moving picture during video playback, and data of one video frame includes container frame header (CFH) data and frame data (for example, F1, F2, and Fn in FIG. 1). The container header data and the container tail data are used to store a coder-decoder (CODEC) type used by the video file, a decoding parameter, and storage location information and index data of the video data, where the index data is used to record a timestamp-based index of frame data of each video frame. The CFH of a video frame is used to store a timestamp of the video frame and storage location information of the video frame, and Fn indicates frame data of an nth video frame and is also referred to as CODEC data of the nth video frame. An aggregate of frame data of each video frame forms a video data stream (that is, a CODEC data stream) after coding. The container header data, the container tail data, and the CFH are collectively referred to as container data.
In the prior art, if a container header data and a container tail data in a video file are corrupted, a video data stream may be sequentially scanned according to various known container formats so as to extract a CFH of each video frame and frame data of each video frame. The container header data and the container tail data are reconstructed according to the CFH and the frame data of each video frame, and a player can normally play the video file according to the reconstructed container header data and container tail data. If the container header data and the container tail data in the video file and the CFH of a video frame are all corrupted, the video file cannot be repaired using the existing video repairing technology, thereby resulting in a low success rate of video file repair in the prior art.